/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.im.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author yun
* @date 2024-02-20
**/
@Entity
@Data
@Table(name="issuance_m")
public class IssuanceM implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`im_id`")
    @ApiModelProperty(value = "发行编号")
    private Integer imId;

    @Column(name = "`im_batch`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "发行批次")
    private String imBatch;

    @Column(name = "`im_token`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "发行令牌")
    private String imToken;

    @Column(name = "`im_brief`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "发行简介")
    private String imBrief;

    @Column(name = "`im_code`")
    @ApiModelProperty(value = "发行状态")
    private String imCode;

    @Column(name = "`im_notice`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "发行通知")
    private String imNotice;

    @Column(name = "`im_user`")
    @ApiModelProperty(value = "发行人")
    private String imUser;

    @Column(name = "`im_date`")
    @CreationTimestamp
    @ApiModelProperty(value = "发行时间")
    private Timestamp imDate;

    public void copy(IssuanceM source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
